package com.itheima.exam.Exam4;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public final class DateUtils {
    public static void DtoS(LocalDateTime dateTime){
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String time = dateTime.format(dtf);
        System.out.println(time);
    }
    public static void StoD(String  time){
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse(time,dtf);
        System.out.println(dateTime);
    }
}
